import request from '@/utils/request'
// 获取所有部门负责人
export const getEmployees = () => request.get('/sys/user/simple')
// 获取所有员工信息
export const getAllEmployees = params => request.get('/sys/user', { params })
// 添加员工
export const addEmployees = data => request.post('/sys/user', data)
// 删除员工
export const delEmployees = id => request.delete(`/sys/user/${id}`)

/**
 * @description: 导入excel
 * @param {*} data
 * @return {*}
 */
export function importEmployee(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

/**
 * @description: 保存员工信息
 * @param {*} data
 * @return {*}
 */
// 补充一个请求
export function saveUserDetailById(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put', // 全量修改
    data
  })
}

export function getJobDetail(id) {
  return request({
    url: `/employees/${id}/jobs`,
    method: 'get'
  })
}

export function assignRoles(data) {
  return request({
    url: `/sys/user/assignRoles`,
    method: 'put', // 全量修改
    data
  })
}

